package com.qfedu.mavenk.beanDemo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import org.springframework.stereotype.Service;

/**
 * @author:huayuzhuo
 * @email:2798866329@qq.com
 * @desc:
 * @datatime: 2022/10/20 10:52
 */
public class App05 {
    private Service mainService;
    private Service[] services;

    //set方法注入
    public void setMainService(Service mainService) {
        this.mainService = mainService;
    }
    public void setServices(Service[] services) {
        this.services = services;
    }

    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-context.xml");
        App05 app05 = (App05) context.getBean("app05");
        System.out.println(app05.mainService);
        System.out.println(app05.services.length);
        ((ClassPathXmlApplicationContext)context).close();
    }
}
